<template>
  <tbody>
    <tr>
      <input type="checkbox" v-model="mor.checked" />
      <th>{{ mor.name }}</th>
      <th>{{ mor.price }}</th>
      <th>
        <button @click="$emit('BtnDel', mor, index, sum)">-</button>{{ mor.num
        }}<button @click="$emit('BtnAdd', mor, index, sum)">+</button>
      </th>
      <!-- num总价，计算属性得来 -->
      <th>{{ sum }}</th>
      <button @click="$emit('tou', index)">删除</button>
      <button @click="$emit('empty', mor)">清除数量</button>
    </tr>
  </tbody>
</template>

<script>
export default {
  name: 'zi',
  // mor当前项，list数组本身，index索引
  props: ['mor', 'list', 'index'],
  computed: {
    // 总价计算
    sum() {
      return this.mor.num * this.mor.price
    },
  },
}
</script>

<style></style>
